home *** CD-ROM | disk | FTP | other *** search
/ Programmer Plus 2007 / Programmer-Plus-2007.iso / Programming / Visual C++ Utilities / i Mag 2.0 / caImagX.CAB / frmEffects.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2003-04-03  |  3.1 KB  |  106 lines

  1. VERSION 5.00
  2. Begin VB.Form frmEffects 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "EFFECTS"
  5.    ClientHeight    =   2265
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   1545
  9.    Icon            =   "frmEffects.frx":0000
  10.    LinkTopic       =   "Form1"
  11.    LockControls    =   -1  'True
  12.    MaxButton       =   0   'False
  13.    MinButton       =   0   'False
  14.    ScaleHeight     =   2265
  15.    ScaleWidth      =   1545
  16.    StartUpPosition =   3  'Windows Default
  17.    Begin VB.CommandButton cmEff 
  18.       Caption         =   "Shrapen"
  19.       Height          =   375
  20.       Index           =   3
  21.       Left            =   210
  22.       TabIndex        =   3
  23.       Top             =   1560
  24.       Width           =   1095
  25.    End
  26.    Begin VB.CommandButton cmEff 
  27.       Caption         =   "Soften"
  28.       Height          =   375
  29.       Index           =   2
  30.       Left            =   210
  31.       TabIndex        =   2
  32.       Top             =   1110
  33.       Width           =   1095
  34.    End
  35.    Begin VB.CommandButton cmEff 
  36.       Caption         =   "Invert"
  37.       Height          =   375
  38.       Index           =   1
  39.       Left            =   210
  40.       TabIndex        =   1
  41.       Top             =   660
  42.       Width           =   1095
  43.    End
  44.    Begin VB.CommandButton cmEff 
  45.       Caption         =   "Filter"
  46.       Height          =   375
  47.       Index           =   0
  48.       Left            =   210
  49.       TabIndex        =   0
  50.       Top             =   210
  51.       Width           =   1095
  52.    End
  53. Attribute VB_Name = "frmEffects"
  54. Attribute VB_GlobalNameSpace = False
  55. Attribute VB_Creatable = False
  56. Attribute VB_PredeclaredId = True
  57. Attribute VB_Exposed = False
  58. Option Explicit
  59. Private m_ChangePalette As Boolean
  60. Public Property Get ChangePalette() As Boolean
  61.     ChangePalette = m_ChangePalette
  62. End Property
  63. Private Sub cmEff_Click(Index As Integer)
  64. On Error GoTo SErr
  65. SErr: If ErrS Then Exit Sub
  66.     Dim f As Form
  67.     Set f = frmTest
  68.     If Index = 0 Then
  69.         Dim r(255) As Integer, g(255) As Integer, b(255) As Integer
  70.         Dim n As Integer
  71.         f.piX.Undo_Add "Filter"
  72.         For n = 0 To 255
  73.             r(n) = n
  74.             g(n) = n
  75.         Next
  76.         f.piX.Filter r(), g(), b()
  77.         f.piX.Undo_AddPalette
  78.     ElseIf Index = 1 Then
  79.         f.piX.Undo_Add "Invert"
  80.         f.piX.Invert
  81.         f.piX.Undo_AddPalette
  82.     ElseIf Index = 2 Then
  83.         f.piX.Undo_Add "Soften"
  84.         f.piX.Soften
  85.         m_ChangePalette = True
  86.     ElseIf Index = 3 Then
  87.         f.piX.Undo_Add "Sharpen"
  88.         f.piX.Sharpen
  89.         m_ChangePalette = True
  90.     End If
  91. End Sub
  92. Function ErrS() As Boolean
  93.     ErrS = False
  94.     If Err.Number <> 0 Then
  95.         MsgBox "Error with number: " & Format(Err.Number, "#,##0") & vbCr & vbCr & Err.Description, vbCritical, "ERROR"
  96.         ErrS = True
  97.         Err.Clear
  98.     End If
  99. End Function
  100. Private Sub Form_Load()
  101. On Error GoTo SErr
  102. SErr: If ErrS Then Exit Sub
  103.     m_ChangePalette = False
  104.     Move frmTest.Left + frmTest.Width - Width - 500, frmTest.Top + frmTest.Height - Height - 500
  105. End Sub
  106.